﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Xml.Serialization;

namespace CDHunter
{
    [Serializable]
    public class ProductInfo
    {
        private Uri _productURI;

        [XmlIgnore()]
        public Uri ProductURI
        {
            get { return _productURI; }
            set { _productURI = value; }
        }

        private string _productID;

        [XmlElement("ProductID")]
        public string ProductID
        {
            get { return _productID; }
            set { _productID = value; }
        }

        private string _productTitle;

        [XmlElement("ProductTitle")]
        public string ProductTitle
        {
            get { return _productTitle; }
            set { _productTitle = value; }
        }

        //Override Equals Method
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return false;
            }

            // If parameter cannot be cast to Point return false.
            ProductInfo p = obj as ProductInfo;
            if ((System.Object)p == null)
            {
                return false;
            }

            // Return true if the fields match:
            return (ProductID == p.ProductID);
        }

        //Override GetHashCode Method
        public override int GetHashCode()
        {
            return (this.ProductID.GetHashCode() ^ this.ProductTitle.GetHashCode());
        }
    }
}
